package day02;
//int类型的演示
public class IntDemo {
    public static void main(String[] args) {
        //1)int:整型, 4个字节, -2^31到2^31-1(正负21个多亿)
        int a = 25; //25为整数直接量, 默认为int类型
        //int b = 10000000000; //编译错误, 100亿默认为int类型, 但超出范围了
        //int c = 3.14; //编译错误, 整型变量中只能装整数

        System.out.println(5/2);    //2
        System.out.println(2/5);    //0
        System.out.println(5/2.0);  //2.5

        int d = 2147483647; //int的最大值
        d = d+1;
        System.out.println(d); //-2147483648(int的最小值), 发生溢出了, 需要避免

        //------------------------------------------------------------------------
        //第二遍
        /*
        int a = 25;

        System.out.println(5/2);    //2
        System.out.println(2/5);    //0
        System.out.println(5/2.0);  //2.5

        int d = 2147483647;
        d = d+1;
        System.out.println(d);

        //第三遍
        int a = 25;
        System.out.println(5/2);    //2
        System.out.println(2/5);    //0
        System.out.println(5/2.0);  //2.5

        int d = 2147483647;
        d = d+1;
        System.out.println(d);
        */
    }
}
